package pcb.views.sharedAssets 
{
	import com.yahoo.astra.fl.managers.AlertManager;
	import com.yahoo.astra.utils.InstanceFactory;
	import flash.display.DisplayObject;
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.text.TextFormat;
	import pcb.views.sharedAssets.skins.ProgramaticSkin;
	
	/**
	 * ...
	 * @author Fintan Boyle
	 */
	public class AlertManagerMain extends MovieClip 
	{
		
		public function AlertManagerMain() 
		{
			formatAlert();
		}
		
		public function alert(displayOb:DisplayObject, str:String):void 
		{
			AlertManager.createAlert(displayOb, str);
		}
		
		public function dialog(displayOb:DisplayObject, str:String, title:String, buttons:Array, onButtonClicked:Function):void 
		{
			//AlertManager.createAlert(displayOb, str, title, ["Agree", "Disagree"], onButtonClicked, null, true);
			AlertManager.createAlert(displayOb, str, title, buttons, onButtonClicked, null, true);
		}
		
		private function formatAlert():void
		{			
			var textFormat:TextFormat = new TextFormat("Verdana", 9, 0x000000);
			var titleTextFormat:TextFormat = new TextFormat("Verdana", 9, 0xeeeeee);
			var titleSkin:InstanceFactory = new InstanceFactory(ProgramaticSkin, 
																{width:10, 
																colors:[0x3299FF, 0x3299FF, 0x3299FF], 
																alphas:[1, 1, 1], 
																ratios:[0, 90, 180], 
																height:10, 
																gradientRotation:90});
																
			var upSkin:InstanceFactory = new InstanceFactory(ProgramaticSkin, 
																{width:10, 
																colors:[0x666666, 0xaaaaaa, 0x666666], 
																alphas:[1, 1, 1], 
																ratios:[0, 90, 180], 
																height:10, 
																hasBevel:true,
																bevelShadow:0x666666,
																gradientRotation:90});			
			
			var overSkin:InstanceFactory = new InstanceFactory(ProgramaticSkin, 
																{width:10, 
																colors:[0x666666, 0xdddddd, 0x666666], 
																alphas:[1, 1, 1], 
																ratios:[0, 90, 180], 
																height:10, 
																hasBevel:true,
																bevelShadow:0x666666,
																gradientRotation:90});			
			
			var downSkin:InstanceFactory = new InstanceFactory(ProgramaticSkin, 
																{width:10, 
																colors:[0x666666, 0xaaaaaa, 0x666666], 
																alphas:[1, 1, 1], 
																ratios:[0, 90, 180], 
																height:10, 
																borderWidth:2,
																borderAlpha:.5,
																hasBevel:true,
																borderColor:0x000000,
																bevelAngle:225,
																bevelShadow:0x999999,
																gradientRotation:90});
																
			var bgSkin:InstanceFactory = new InstanceFactory(ProgramaticSkin, {
																width:10, 
																colors:[0x3299FF, 0x3299FF, 0x3299FF], 
																alphas:[1, 1, 1], 
																ratios:[0, 90, 180], 
																height:10, 
																gradientRotation:90});
																
			var focusRectSkin:InstanceFactory = new InstanceFactory(ProgramaticSkin, {
																width:10,
																height:10,
																colors:[0x000000],
																alphas:[0],
																ratios:[0],
																borderWidth:2,
																borderAlpha:.5,
																hasBevel:true,
																borderColor:0x666666});
			
			AlertManager.setTitleBarStyle("backgroundSkin", titleSkin);
			AlertManager.setTitleBarStyle("titleTextFormat", textFormat);
			AlertManager.setButtonStyle("upSkin", upSkin);
			AlertManager.setButtonStyle("overSkin", overSkin);
			AlertManager.setButtonStyle("downSkin", downSkin);
			
			AlertManager.setButtonStyle("focusRectSkin", focusRectSkin);
			AlertManager.setButtonStyle("textFormat", textFormat);
			AlertManager.setAlertStyle("skin", bgSkin);
			AlertManager.setMessageBoxStyle("textFormat", textFormat);
		}
		
		
	}
	
}